<template>
  <div class="company-management">
    
    <!-- 搜索栏 -->
    <el-card class="search-card">
      <el-form :inline="true" :model="searchForm" class="search-form">
        <el-form-item label="企业ID">
          <el-input v-model="searchForm.enterpriseUserId" placeholder="请输入企业ID" />
        </el-form-item>
        <el-form-item label="注册邮箱">
          <el-input v-model="searchForm.email" placeholder="请输入注册邮箱" />
        </el-form-item>
        <el-form-item label="公司名称">
          <el-input v-model="searchForm.companyFullName" placeholder="请输入公司名称" />
        </el-form-item>
        <el-form-item label="联系电话">
          <el-input v-model="searchForm.contactPhoneNumber" placeholder="请输入联系电话" />
        </el-form-item>
        <el-form-item label="认证状态">
          <el-select v-model="searchForm.certificationStatus" placeholder="请选择认证状态" style="width: 200px;">
            <el-option label="全部" value="" />
            <el-option label="已通过" value="已通过" />
            <el-option label="待审核" value="待审核" />
            <el-option label="未认证" value="未认证" />
            <el-option label="已驳回" value="已驳回" />
          </el-select>
        </el-form-item>
        <el-form-item label="账户状态">
          <el-select v-model="searchForm.accountStatus" placeholder="请选择账户状态" style="width: 200px;">
            <el-option label="全部" value="" />
            <el-option label="正常" value="active" />
            <el-option label="禁用" value="disabled" />
            <el-option label="锁定" value="locked" />
            <el-option label="待激活" value="pending" />
          </el-select>
        </el-form-item>
        <el-form-item label="邮箱验证">
          <el-select v-model="searchForm.emailVerified" placeholder="请选择邮箱验证状态" style="width: 200px;">
            <el-option label="全部" value="" />
            <el-option label="已验证" value="true" />
            <el-option label="未验证" value="false" />
          </el-select>
        </el-form-item>
        <el-form-item label="企业认证">
          <el-select v-model="searchForm.hasEnterpriseId" placeholder="请选择企业认证状态" style="width: 200px;">
            <el-option label="全部" value="" />
            <el-option label="已认证" value="true" />
            <el-option label="未认证" value="false" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleSearch">搜索</el-button>
          <el-button @click="handleReset">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    
    <!-- 数据表格 -->
    <el-card class="table-card">
      <template #header>
        <div class="table-header">
          <span>企业列表</span>
          <el-button type="primary" @click="handleRefresh">刷新</el-button>
        </div>
      </template>
      
      <el-table :data="tableData" style="width: 100%" v-loading="loading">
        <el-table-column prop="enterpriseUserId" label="企业ID" min-width="8%" />
        <el-table-column prop="email" label="注册邮箱" min-width="18%" />
        <el-table-column prop="companyFullName" label="公司名称" min-width="18%" />
        <el-table-column prop="contactPhoneNumber" label="联系电话" min-width="12%" />
        <el-table-column prop="registrationTime" label="注册时间" min-width="12%">
          <template #default="scope">
            {{ formatDate(scope.row.registrationTime) }}
          </template>
        </el-table-column>
        <el-table-column prop="lastLoginTime" label="最后登录" min-width="12%">
          <template #default="scope">
            {{ formatDate(scope.row.lastLoginTime) }}
          </template>
        </el-table-column>
        <el-table-column prop="accountStatus" label="账户状态" min-width="8%">
          <template #default="scope">
            <el-tag :type="getAccountStatusType(scope.row.accountStatus)">
              {{ getAccountStatusText(scope.row.accountStatus) }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="emailVerified" label="邮箱验证" min-width="8%">
          <template #default="scope">
            <el-tag :type="scope.row.emailVerified ? 'success' : 'danger'">
              {{ scope.row.emailVerified ? '已验证' : '未验证' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="enterpriseId" label="企业认证" min-width="8%">
          <template #default="scope">
            <el-tag :type="scope.row.enterpriseId ? 'success' : 'danger'">
              {{ scope.row.enterpriseId ? '已认证' : '未认证' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="certificationStatus" label="认证状态" min-width="10%">
          <template #default="scope">
            <el-tag :type="getCertificationStatusType(scope.row.certificationStatus)">
              {{ scope.row.certificationStatus }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="15%">
          <template #default="scope">
            <el-button 
              type="info" 
              size="small" 
              @click="handleViewDetail(scope.row)"
              :disabled="!scope.row.enterpriseId"
              :title="!scope.row.enterpriseId ? '该企业尚未进行企业认证' : ''"
            >
              {{ scope.row.enterpriseId ? '查看资料' : '未认证' }}
            </el-button>
            <el-button type="primary" size="small" @click="handleEdit(scope.row)">
              编辑资料
            </el-button>
            <el-button 
              v-if="scope.row.accountStatus === 'active'"
              type="danger" 
              size="small" 
              @click="handleDisable(scope.row)"
            >
              禁用
            </el-button>
            <el-button 
              v-if="scope.row.accountStatus === 'disabled'"
              type="success" 
              size="small" 
              @click="handleEnable(scope.row)"
            >
              启用
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      
      <!-- 分页 -->
      <div class="pagination">
        <el-pagination
          v-model:current-page="currentPage"
          v-model:page-size="pageSize"
          :page-sizes="[10, 20, 50, 100]"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </el-card>
    
    <!-- 详情对话框 -->
    <el-dialog
      v-model="detailDialogVisible"
      title="企业认证资料详情"
      width="75%"
      class="enterprise-detail-dialog"
    >
      <div v-if="currentDetail" class="detail-container">
        <!-- 基本信息 -->
        <el-card class="detail-card">
          <template #header>
            <div class="card-header">
              <el-icon><Document /></el-icon>
              <span>基本信息</span>
            </div>
          </template>
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="info-item">
                <label>企业ID：</label>
                <span>{{ currentDetail.enterpriseId }}</span>
              </div>
              <div class="info-item">
                <label>企业用户ID：</label>
                <span>{{ currentDetail.enterpriseUserId }}</span>
              </div>
              <div class="info-item">
                <label>公司全称：</label>
                <span>{{ currentDetail.companyFullName }}</span>
              </div>
              <div class="info-item">
                <label>统一社会信用代码：</label>
                <span>{{ currentDetail.socialCreditCode }}</span>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="info-item">
                <label>联系人姓名：</label>
                <span>{{ currentDetail.operatorName }}</span>
              </div>
              <div class="info-item">
                <label>联系人职位：</label>
                <span>{{ currentDetail.operatorPosition }}</span>
              </div>
              <div class="info-item">
                <label>联系电话：</label>
                <span>{{ currentDetail.contactPhoneNumber }}</span>
              </div>
              <div class="info-item">
                <label>联系邮箱：</label>
                <span>{{ currentDetail.contactEmail }}</span>
              </div>
            </el-col>
          </el-row>
        </el-card>

        <!-- 认证状态 -->
        <el-card class="detail-card">
          <template #header>
            <div class="card-header">
              <el-icon><Check /></el-icon>
              <span>认证状态</span>
            </div>
          </template>
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="info-item">
                <label>认证状态：</label>
                <el-tag :type="getCertificationStatusType(currentDetail.certificationStatusDescription)" size="large">
                  {{ currentDetail.certificationStatusDescription }}
                </el-tag>
              </div>
            </el-col>
            <el-col :span="12" v-if="currentDetail.certificationRejectionReason">
              <div class="info-item">
                <label>驳回原因：</label>
                <span class="rejection-reason">{{ currentDetail.certificationRejectionReason }}</span>
              </div>
            </el-col>
          </el-row>
        </el-card>

        <!-- 企业信息 -->
        <el-card class="detail-card">
          <template #header>
            <div class="card-header">
              <el-icon><OfficeBuilding /></el-icon>
              <span>企业信息</span>
            </div>
          </template>
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="info-item">
                <label>所属行业：</label>
                <span>{{ currentDetail.industry }}</span>
              </div>
              <div class="info-item">
                <label>公司规模：</label>
                <span>{{ currentDetail.companyScale }}</span>
              </div>
              <div class="info-item">
                <label>公司地址：</label>
                <span>{{ currentDetail.companyAddress }}</span>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="info-item">
                <label>官方网站：</label>
                <a :href="currentDetail.officialWebsiteUrl" target="_blank" v-if="currentDetail.officialWebsiteUrl" class="website-link">
                  {{ currentDetail.officialWebsiteUrl }}
                </a>
                <span v-else>-</span>
              </div>
            </el-col>
          </el-row>
          <div class="info-section">
            <div class="info-item full-width">
              <label>主营业务：</label>
              <span>{{ currentDetail.mainBusiness }}</span>
            </div>
            <div class="info-item full-width">
              <label>公司介绍：</label>
              <div class="company-intro">{{ currentDetail.companyIntroduction }}</div>
            </div>
          </div>
        </el-card>

        <!-- 证照信息 -->
        <el-card class="detail-card">
          <template #header>
            <div class="card-header">
              <el-icon><Picture /></el-icon>
              <span>证照信息</span>
            </div>
          </template>
          <div class="certificates-grid">
            <div class="certificate-section license-section">
              <h4 class="section-title">营业执照</h4>
              <div class="license-container">
                <el-image 
                  v-if="currentDetail.businessLicenseUrl"
                  :src="currentDetail.businessLicenseUrl" 
                  class="license-image-new"
                  fit="contain"
                />
                <div v-else class="no-image-new">
                  <i class="el-icon-picture"></i>
                  <span>暂无营业执照</span>
                </div>
              </div>
            </div>
            <div class="certificate-section logo-section">
              <h4 class="section-title logo-section-title">公司Logo</h4>
              <div class="logo-container">
                <el-image 
                  v-if="currentDetail.companyLogoUrl"
                  :src="currentDetail.companyLogoUrl" 
                  class="logo-image-new"
                  fit="contain"
                />
                <div v-else class="no-image-new">
                  <i class="el-icon-picture"></i>
                  <span>暂无公司Logo</span>
                </div>
              </div>
            </div>
          </div>
        </el-card>
      </div>
    </el-dialog>
    
    <!-- 编辑对话框 -->
    <el-dialog
      v-model="editDialogVisible"
      title="编辑企业资料"
      width="60%"
    >
      <el-form :model="editForm" label-width="100px" v-if="editForm">
        <el-form-item label="企业ID">
          <el-input v-model="editForm.enterpriseUserId" disabled />
        </el-form-item>
        <el-form-item label="注册邮箱">
          <el-input v-model="editForm.email" />
        </el-form-item>
        <el-form-item label="公司名称">
          <el-input v-model="editForm.companyFullName" />
        </el-form-item>
        <el-form-item label="联系电话">
          <el-input v-model="editForm.contactPhoneNumber" />
        </el-form-item>
        <el-form-item label="账户状态">
          <el-select v-model="editForm.accountStatus">
            <el-option label="正常" value="active" />
            <el-option label="禁用" value="disabled" />
            <el-option label="锁定" value="locked" />
            <el-option label="待激活" value="pending" />
          </el-select>
        </el-form-item>
        <el-form-item label="邮箱验证">
          <el-select v-model="editForm.emailVerified">
            <el-option label="已验证" :value="true" />
            <el-option label="未验证" :value="false" />
          </el-select>
        </el-form-item>
        <el-form-item label="认证状态">
          <el-select v-model="editForm.certificationStatus">
            <el-option label="已通过" value="已通过" />
            <el-option label="待审核" value="待审核" />
            <el-option label="未认证" value="未认证" />
            <el-option label="已驳回" value="已驳回" />
          </el-select>
        </el-form-item>
        <el-form-item label="偏好语言">
          <el-select v-model="editForm.preferredLanguage">
            <el-option label="中文" value="zh-CN" />
            <el-option label="English" value="en-US" />
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="editDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="handleConfirmEdit">确认修改</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Document, Check, OfficeBuilding, Picture } from '@element-plus/icons-vue'
import { getEnterpriseList, getEnterpriseDetail, disableEnterprise, enableEnterprise } from '@/api/enterpriseManage'

const loading = ref(false)
const currentPage = ref(1)
const pageSize = ref(10)
const total = ref(0)
const detailDialogVisible = ref(false)
const editDialogVisible = ref(false)
const currentDetail = ref(null)
const editForm = ref(null)

const searchForm = reactive({
  enterpriseUserId: '',
  email: '',
  companyFullName: '',
  contactPhoneNumber: '',
  certificationStatus: '',
  accountStatus: '',
  emailVerified: ''
})

const tableData = ref([])
const originalData = ref([]) // 保存原始数据
const filteredData = ref([]) // 保存筛选后的数据

const getCertificationStatusType = (status) => {
  const statusMap = {
    '已通过': 'success',
    '待审核': 'warning',
    '未认证': 'danger',
    '已驳回': 'info'
  }
  return statusMap[status] || 'info'
}

const getAccountStatusType = (status) => {
  const statusMap = {
    'active': 'success',
    'disabled': 'danger',
    'locked': 'warning',
    'pending': 'info'
  }
  return statusMap[status] || 'info'
}

const getAccountStatusText = (status) => {
  const statusMap = {
    'active': '正常',
    'disabled': '禁用',
    'locked': '锁定',
    'pending': '待激活'
  }
  return statusMap[status] || status
}

const formatDate = (dateString) => {
  if (!dateString) return '-'
  const date = new Date(dateString)
  return date.toLocaleString('zh-CN', {
    year: 'numeric',
    month: '2-digit',
    day: '2-digit',
    hour: '2-digit',
    minute: '2-digit'
  })
}

// 前端搜索筛选函数
const filterData = () => {
  let filtered = [...originalData.value]
  
  // 企业ID筛选
  if (searchForm.enterpriseUserId) {
    filtered = filtered.filter(item => 
      item.enterpriseUserId && item.enterpriseUserId.toString().includes(searchForm.enterpriseUserId)
    )
  }
  
  // 注册邮箱筛选
  if (searchForm.email) {
    filtered = filtered.filter(item => 
      item.email && item.email.toLowerCase().includes(searchForm.email.toLowerCase())
    )
  }
  
  // 公司名称筛选
  if (searchForm.companyFullName) {
    filtered = filtered.filter(item => 
      item.companyFullName && item.companyFullName.toLowerCase().includes(searchForm.companyFullName.toLowerCase())
    )
  }
  
  // 联系电话筛选
  if (searchForm.contactPhoneNumber) {
    filtered = filtered.filter(item => 
      item.contactPhoneNumber && item.contactPhoneNumber.includes(searchForm.contactPhoneNumber)
    )
  }
  
  // 认证状态筛选
  if (searchForm.certificationStatus) {
    filtered = filtered.filter(item => 
      item.certificationStatus === searchForm.certificationStatus
    )
  }
  
  // 账户状态筛选
  if (searchForm.accountStatus) {
    filtered = filtered.filter(item => 
      item.accountStatus === searchForm.accountStatus
    )
  }
  
  // 邮箱验证筛选
  if (searchForm.emailVerified !== '') {
    const isVerified = searchForm.emailVerified === 'true'
    filtered = filtered.filter(item => 
      item.emailVerified === isVerified
    )
  }
  
  // 企业认证筛选
  if (searchForm.hasEnterpriseId !== '') {
    const hasEnterprise = searchForm.hasEnterpriseId === 'true'
    filtered = filtered.filter(item => 
      (item.enterpriseId && hasEnterprise) || (!item.enterpriseId && !hasEnterprise)
    )
  }
  
  filteredData.value = filtered
  total.value = filtered.length
  currentPage.value = 1 // 重置到第一页
  
  // 计算分页显示
  const start = 0
  const end = pageSize.value
  tableData.value = filtered.slice(start, end)
}

const handleSearch = () => {
  filterData()
}

const handleReset = () => {
  searchForm.enterpriseUserId = ''
  searchForm.email = ''
  searchForm.companyFullName = ''
  searchForm.contactPhoneNumber = ''
  searchForm.certificationStatus = ''
  searchForm.accountStatus = ''
  searchForm.emailVerified = ''
  searchForm.hasEnterpriseId = ''
  
  // 重置为显示所有数据
  tableData.value = [...originalData.value]
  filteredData.value = [...originalData.value]
  total.value = originalData.value.length
  currentPage.value = 1
}

const handleRefresh = () => {
  fetchEnterpriseList()
  // 清空搜索条件
  searchForm.enterpriseUserId = ''
  searchForm.email = ''
  searchForm.companyFullName = ''
  searchForm.contactPhoneNumber = ''
  searchForm.certificationStatus = ''
  searchForm.accountStatus = ''
  searchForm.emailVerified = ''
  searchForm.hasEnterpriseId = ''
}

const handleViewDetail = async (row) => {
  try {
    // 检查是否有 enterpriseId，如果没有说明没有进行企业认证
    if (!row.enterpriseId) {
      ElMessage.warning('该企业尚未进行企业认证，无法查看详细资料')
      return
    }
    
    const response = await getEnterpriseDetail(row.enterpriseId)
    if (response.code === 200) {
      // 修改这里：处理图片URL，使用环境变量添加前缀
      const data = response.data
      currentDetail.value = {
        ...data,
        businessLicenseUrl: data.businessLicenseUrl ? `${__API_BASE_URL__}${data.businessLicenseUrl}` : null,
        companyLogoUrl: data.companyLogoUrl ? `${__API_BASE_URL__}${data.companyLogoUrl}` : null
      }
      detailDialogVisible.value = true
    } else {
      ElMessage.error(response.message || '获取企业详情失败')
    }
  } catch (error) {
    console.error('获取企业详情失败:', error)
    ElMessage.error('获取企业详情失败')
  }
}

const handleEdit = (row) => {
  editForm.value = { ...row }
  editDialogVisible.value = true
}

const handleConfirmEdit = () => {
  // 实现编辑逻辑
  ElMessage.success('企业资料已更新')
  editDialogVisible.value = false
}

const handleDisable = (row) => {
  ElMessageBox.confirm(
    '确定要禁用该企业账户吗？',
    '确认操作',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }
  ).then(async () => {
    try {
      const response = await disableEnterprise(row.enterpriseUserId)
      if (response.code === 200) {
        ElMessage.success(response.message || '企业账户已禁用')
        fetchEnterpriseList() // 刷新列表
      } else {
        ElMessage.error(response.message || '禁用失败')
      }
    } catch (error) {
      console.error('禁用企业失败:', error)
      ElMessage.error('禁用企业失败')
    }
  })
}

const handleEnable = (row) => {
  ElMessageBox.confirm(
    '确定要启用该企业账户吗？',
    '确认操作',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }
  ).then(async () => {
    try {
      const response = await enableEnterprise(row.enterpriseUserId)
      if (response.code === 200) {
        ElMessage.success(response.message || '企业账户已启用')
        fetchEnterpriseList() // 刷新列表
      } else {
        ElMessage.error(response.message || '启用失败')
      }
    } catch (error) {
      console.error('启用企业失败:', error)
      ElMessage.error('启用企业失败')
    }
  })
}

const handleSizeChange = (val) => {
  pageSize.value = val
  // 基于筛选后的数据重新计算分页
  const start = (currentPage.value - 1) * val
  const end = start + val
  tableData.value = filteredData.value.slice(start, end)
}

const handleCurrentChange = (val) => {
  currentPage.value = val
  // 基于筛选后的数据重新计算分页
  const start = (val - 1) * pageSize.value
  const end = start + pageSize.value
  tableData.value = filteredData.value.slice(start, end)
}

// 获取企业列表
const fetchEnterpriseList = async () => {
  loading.value = true
  try {
    const params = {
      page: 1,
      pageSize: 1000 // 获取所有数据用于前端筛选
    }
    
    const response = await getEnterpriseList(params)
    if (response.code === 200) {
      originalData.value = response.data
      filteredData.value = [...response.data]
      
      // 计算分页显示
      const start = (currentPage.value - 1) * pageSize.value
      const end = start + pageSize.value
      tableData.value = response.data.slice(start, end)
      total.value = response.data.length
    } else {
      ElMessage.error(response.message || '获取企业列表失败')
    }
  } catch (error) {
    console.error('获取企业列表失败:', error)
    ElMessage.error('获取企业列表失败')
  } finally {
    loading.value = false
  }
}

onMounted(() => {
  fetchEnterpriseList()
})
</script>

<style scoped>
.company-management {
  padding: 0;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
}

.company-management h2 {
  margin-bottom: 20px;
  color: #333;
}

.search-card {
  margin-bottom: 20px;
  width: 100%;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.search-form .el-form-item {
  margin-bottom: 16px;
  margin-right: 0;
}

.search-form .el-form-item__label {
  font-weight: 500;
  color: #333;
}

.search-form .el-input,
.search-form .el-select {
  min-width: 200px;
}

.table-card {
  margin-bottom: 20px;
  width: 100%;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pagination {
  margin-top: 20px;
  text-align: right;
}

.detail-section {
  margin-top: 20px;
}

.detail-section h4 {
  margin-bottom: 10px;
  color: #333;
}

.detail-section p {
  color: #666;
  line-height: 1.6;
}

.image-container {
  margin-top: 10px;
}

.enterprise-detail-dialog .el-dialog__body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.detail-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-card {
  margin-bottom: 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-card .el-card__header {
  padding: 16px 20px;
  border-bottom: 1px solid #ebeef5;
  background-color: #f8f9fa;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.card-header .el-icon {
  color: #409EFF;
}

.detail-card .el-card__body {
  padding: 20px;
}

.info-item {
  display: flex;
  margin-bottom: 12px;
  align-items: flex-start;
}

.info-item label {
  min-width: 120px;
  font-weight: 500;
  color: #333;
  margin-right: 8px;
  flex-shrink: 0;
}

.info-item span {
  color: #666;
  line-height: 1.5;
  flex: 1;
}

.info-item.full-width {
  flex-direction: column;
  margin-bottom: 16px;
}

.info-item.full-width label {
  margin-bottom: 8px;
  min-width: auto;
}

.info-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #ebeef5;
}

.company-intro {
  background-color: #f8f9fa;
  padding: 12px;
  border-radius: 4px;
  line-height: 1.6;
  color: #666;
  margin-top: 8px;
}

.website-link {
  color: #409EFF;
  text-decoration: none;
  word-break: break-all;
}

.website-link:hover {
  text-decoration: underline;
}

.rejection-reason {
  color: #f56c6c;
  background-color: #fef0f0;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
}

.image-section {
  text-align: center;
}

.image-section h4 {
  margin-bottom: 12px;
  color: #333;
  font-size: 14px;
  font-weight: 500;
}

.image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 120px;
  border: 2px dashed #dcdfe6;
  border-radius: 8px;
  background-color: #fafafa;
}

.license-image,
.logo-image {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s;
}

.license-image:hover,
.logo-image:hover {
  transform: scale(1.05);
}

.no-image {
  color: #909399;
  font-size: 14px;
}

/* 新的证照信息样式 */
.certificates-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  padding: 20px 0;
}

.certificate-section {
  display: flex;
  flex-direction: column;
}

.section-title {
  margin: 0 0 16px 0;
  color: #2c3e50;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 2px solid #3498db;
}

.logo-section-title {
  border-bottom-color: #e74c3c;
}

.license-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  background: #fafafa;
  border: 2px dashed #dcdfe6;
  border-radius: 8px;
  padding: 16px;
  transition: border-color 0.3s ease;
}

.license-container:hover {
  border-color: #3498db;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  background: #fafafa;
  border: 2px dashed #dcdfe6;
  border-radius: 8px;
  padding: 16px;
  transition: border-color 0.3s ease;
}

.logo-container:hover {
  border-color: #e74c3c;
}

.license-image-new {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.license-image-new:hover {
  transform: scale(1.02);
}

.logo-image-new {
  max-width: 150px;
  max-height: 150px;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.logo-image-new:hover {
  transform: scale(1.05);
}

.no-image-new {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #909399;
  font-size: 14px;
}

.no-image-new i {
  font-size: 48px;
  margin-bottom: 12px;
  color: #c0c4cc;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .certificates-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .license-container {
    min-height: 300px;
  }
  
  .logo-container {
    min-height: 180px;
  }
  
  .logo-image-new {
    max-width: 120px;
    max-height: 120px;
  }
}
</style>